package com.edu.exam.enums.grading;

/**
 * 配置分类枚举
 */
public enum ConfigCategory {
    SYSTEM("SYSTEM", "系统配置"),
    WORKFLOW("WORKFLOW", "工作流配置"),
    PERMISSION("PERMISSION", "权限配置"),
    NOTIFICATION("NOTIFICATION", "通知配置"),
    SECURITY("SECURITY", "安全配置"),
    BUSINESS("BUSINESS", "业务配置");

    private final String code;
    private final String description;

    ConfigCategory(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static ConfigCategory fromCode(String code) {
        for (ConfigCategory category : values()) {
            if (category.getCode().equals(code)) {
                return category;
            }
        }
        throw new IllegalArgumentException("Unknown config category code: " + code);
    }

    @Override
    public String toString() {
        return description;
    }
}